﻿<Window x:Class="Waf.InformationManager.Infrastructure.Modules.Presentation.Views.ShellWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="clr-namespace:Waf.InformationManager.Infrastructure.Modules.Applications.ViewModels;assembly=Waf.InformationManager.Infrastructure.Modules.Applications"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        Title="{Binding Title}" Icon="{StaticResource InformationManagerImageSource}" Height="650" Width="1024"
        d:DataContext="{d:DesignInstance vm:ShellViewModel}">

    <Window.InputBindings>
        <KeyBinding Command="{Binding AboutCommand}" Key="F1"/>
    </Window.InputBindings>

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="175"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        
        <ToolBar x:Name="toolBar" Grid.ColumnSpan="2" Grid.Row="0">
            <Button Command="{Binding AboutCommand}" ToolTip="Shows the about dialog."><AccessText Text="_About"/></Button>
            <Button Command="{Binding ExitCommand}" ToolTip="Close the application."><AccessText Text="E_xit"/></Button>
        </ToolBar>
        
        <TreeView x:Name="navigationView" Grid.Column="0" Grid.Row="1" BorderThickness="0" Margin="0,0,4,0">
            <TreeView.Resources>
                <Style TargetType="TreeViewItem" BasedOn="{StaticResource {x:Type TreeViewItem}}">
                    <Setter Property="Padding" Value="5"/>
                    <Setter Property="IsSelected" Value="{Binding IsSelected}"/>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding IsFirstItemOfNewGroup}" Value="True">
                            <Setter Property="Margin" Value="0,11,0,0"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </TreeView.Resources>

            <TreeViewItem x:Name="rootItem" Header="Information Manager" ItemsSource="{Binding NavigationService.NavigationNodes}" IsExpanded="True">
                <TreeViewItem.ItemTemplate>
                    <DataTemplate>
                        <TextBlock>
                            <Run Text="{Binding Name, Mode=OneWay}"/>
                            <Run Text="{Binding ItemCount, Mode=OneWay, Converter={StaticResource ItemCountToStringConverter}}" FontWeight="SemiBold"/>
                        </TextBlock>
                    </DataTemplate>
                </TreeViewItem.ItemTemplate>
            </TreeViewItem>
        </TreeView>

        <GridSplitter Grid.Column="0" Grid.Row="1" VerticalAlignment="Stretch" HorizontalAlignment="Right" Width="4"/>
        
        <ContentControl Content="{Binding ShellService.ContentView}" Focusable="False" Grid.Column="1" Grid.Row="1"/>
    </Grid>
</Window>
